<?php

 namespace Emoney\UserBundle\Form\Type;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use FOS\UserBundle\Form\Type\RegistrationFormType;

class UserType extends RegistrationFormType
{
    private $class ='Emoney\UserBundle\Entity\User';
    public function buildForm(FormBuilder $builder, array $options){
        
     $builder->add('group', 'entity', array('class' => 'Emoney\UserBundle\Entity\Group',
	 'property' => 'name',
	 'expanded' => false,
	 'multiple' => false,
	 'required' => true,
     'label'    => 'Type Account'  
				)); 

	 $builder
            ->add('username','text',array('required' => true, 'label' => 'User name', 'trim' => true))
            ->add('email','email',array('required' => true, 'label' => 'Email', 'trim' => true))
            ->add('plainPassword','repeated',array('type' => 'password','required' => true, 'label' => 'Password', 'trim' => true,'invalid_message' => 'Two password enter is not correspondant.'))
            ->add('phone','text',array('required' => true, 'label' => 'Telephone', 'trim' => true))
            ->add('adresse','textarea',array('required' => true, 'label' => 'Adress', 'trim' => true))
            ->add('zipcode','text',array('required' => true, 'label' => 'Zip code', 'trim' => true))
            ->add('ville','text',array('required' => true, 'label' => 'City', 'trim' => true))
        ;

    }

    public function __construct(){
        parent::__construct($this->class);
    }
    public function getDefaultOptions(array $options){

        return array(
        'data_class' => $this->class,
        );
    }

    public function getName()
    {
        return 'emoney_userbundle_usertype';
    }
}
